# coding=utf-8

import web
import json
from basecontroller import basecontroller
from services.devicesmanagerservices import DevicesManagerServices


class downloadcontroller(basecontroller):

    def POST(self, path):
        super(downloadcontroller, self).POST(path)
        data = web.data()
        # DevicesManagerServices.set_a_device_info(data)
        return "1"

    def GET(self, path):
        print 'output path', path
        # if path == 'get_devices':
        #     devices = DevicesManagerServices.get_devices_info()
        #     return json.dumps(devices)
        try:
            import os
            print os.path.abspath(".")
            return open('./output/' + path).read()
        except IOError, e:
            print e.message
